global spin_lock
global spin_unlock


spin_lock:
	push ebp
	mov ebp, esp
	mov ecx, [ebp + 8]
	xor eax, eax
	.wait:
		xchg [ecx], eax
		test eax, eax
	jz .wait
	pop ebp
	ret

spin_unlock:
	push ebp
	mov ebp, esp
	mov eax, [ebp + 8]
	LOCK mov [eax], dword 1
	pop ebp
	ret
